package com.zfzs.post.modules.goods.service;

import com.zfzs.post.model.dto.QuerTypePageDTO;
import com.zfzs.post.model.vo.GoodsOrderVO;
import com.zfzs.post.modules.goods.domain.GoodOrder;
import com.zfzs.post.modules.goods.service.dto.GoodOrderQueryCriteria;
import com.zfzs.post.page.JpaPageHelper;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;

/**
* @author ck
* @date 2019-10-18
*/
public interface GoodOrderService {

    /**
    * queryAll 分页
    * @param criteria
    * @param pageable
    * @return
    */
    Object queryAll(GoodOrderQueryCriteria criteria, Pageable pageable);

    /**
    * queryAll 不分页
    * @param criteria
    * @return
    */
    Object queryAll(GoodOrderQueryCriteria criteria);

    /**
     * findById
     * @param id
     * @return
     */
    GoodOrder findById(Integer id);

    /**
     * create
     * @param resources
     * @return
     */
    GoodOrder create(GoodOrder resources);

    /**
     * update
     * @param resources
     */
    void update(GoodOrder resources);

    /**
     * delete
     * @param id
     */
    void delete(Integer id);

    /**
     * 根据代理商 时间查询
     * @param channelId
     * @param ids
     * @param startDate
     * @param endDate
     * @return
     */
    int queryCountByAgentIds(Long channelId, List<Long> ids, String startDate, String endDate);

    /**
     * 采购新增列表
     */
    JpaPageHelper queryOrderByAgentIds(QuerTypePageDTO dto);

    /**
     * 根据订单号查询
     * @param orderNo
     * @return
     */
    GoodOrder findByOrderNo(String orderNo);

    /**
     * 获取个人订单列表
     * @param agentId
     * @param status
     * @param pageNo
     * @return
     */
    Page<GoodOrder> getOwnerList(Long agentId, Integer status, Integer pageNo);

    /**
     * 查询个人所有购买数量
     * @param channelId
     * @param ids
     * @param startDate
     * @param endDate
     * @return
     */
    int queryOrderByAgentIdsSum(Long channelId, List<Long> ids, String startDate, String endDate);

    /**
     * 分页
     * @param criteria
     * @param page
     * @param size
     * @return
     */
    JpaPageHelper<GoodsOrderVO> findGoodsOrderPage(GoodOrderQueryCriteria criteria, Integer page, Integer size);
}